using FluentNHibernate.Conventions;
using FluentNHibernate.Mapping;
using Web.App.Infrastructure.NHibernate.Tools;

namespace Webshop20.Infrastructure.Persistence.NH.AutoMappings.Conventions.Common
{
    public class ManyToManyTableNameConvention  : IHasManyToManyConvention
    {
        public bool Accept(IManyToManyPart target)
        {
            return true;
        }

        public void Apply(IManyToManyPart target)
        {
            target.WithTableName(Inflector.Pluralize(target.ChildType.Name) + "To" + Inflector.Pluralize(target.EntityType.Name));
        }
    }
}